package com.zby.model.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.autotable.annotation.AutoColumn;
import org.dromara.autotable.annotation.PrimaryKey;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author wuyanzhu
 */
@Data
public class BasePojo implements Serializable {
    @PrimaryKey(autoIncrement = true)
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "主键")
    @AutoColumn(comment = "主键")
    private Integer id;

    @Schema(description = "创建时间")
    @AutoColumn(notNull = true, comment = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createdAt;

    @Schema(description = "更新时间")
    @AutoColumn(notNull = true, comment = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updatedAt;

    @TableLogic
    @Schema(description = "是否删除")
    @AutoColumn(defaultValue = "0", notNull = true, comment = "0-未删除，1-已删除")
    private Boolean deleted;
}
